package com.allprs.hmcs.controller;

import com.allprs.common.core.domain.AjaxResult;
import com.allprs.hmcs.entity.Project;
import com.allprs.hmcs.enums.DeviceTypeEnum;
import com.allprs.hmcs.pojo.reqBo.*;
import com.allprs.hmcs.pojo.resBo.BaseMap;
import com.allprs.hmcs.pojo.resBo.NameSelectRes;
import com.allprs.hmcs.service.IBuildManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author wjf
 * @描述:
 * @date 2024年06月13日
 * @version: 1.0
 */

@RestController
@RequestMapping("/build")
@Api(tags = "建设管理")
@Slf4j
public class BuildManageController {


    @Resource
    private IBuildManageService buildManageService;


    @ApiOperation(value = "查询积水点详情")
    @GetMapping("/getPondingInfo")
    public AjaxResult getPondingInfo(PondingQueryBo queryBo){

        return buildManageService.getPondingInfo(queryBo);
    }

    @ApiOperation(value = "查询污水详情")
    @GetMapping("/getSewageInfo")
    public AjaxResult getSewageInfo(SewageQueryBo queryBo){

        return buildManageService.getSewageInfo(queryBo);
    }

    @ApiOperation(value = "新增项目")
    @PostMapping("/addProject")
    public AjaxResult addProject(@RequestBody Project vo){

        return buildManageService.addProject(vo);
    }

    @ApiOperation(value = "查询项目详情")
    @GetMapping("/getProjectInfo")
    public AjaxResult getProjectInfo(ProjectQueryBo queryBo){

        return buildManageService.getProjectInfo(queryBo);
    }

    @ApiOperation(value = "查询设备详情")
    @GetMapping("/getDeviceInfo")
    public AjaxResult getDeviceInfo(DeviceQueryBo queryBo){

        return buildManageService.getDeviceInfo(queryBo);
    }

    @ApiOperation(value = "查询应急物资详情")
    @GetMapping("/getMaterialInfo")
    public AjaxResult getMaterialInfo(MaterialQueryBo queryBo){

        return buildManageService.getMaterialInfo(queryBo);
    }


    @ApiOperation(value = "查询设备类型下拉框")
    @GetMapping("/getDeviceType")
    public AjaxResult getDeviceType(){

        List<BaseMap> collect = Arrays.stream(DeviceTypeEnum.values()).map(DeviceTypeEnum::toBaseMap).collect(Collectors.toList());

        return AjaxResult.success(collect);
    }


}
